package com.hddz.acquisition.fragment.stock;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hddz.acquisition.R;
import com.hddz.acquisition.fragment.BaseFragment;
import com.hddz.acquisition.model.StockJsonRespose;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

@ContentView(R.layout.view_stock_scan)
public class FragmentWarehouseOrInvSum extends BaseFragment {

	@ViewInject(R.id.txt_invname)
	private TextView txt_invname;

	@ViewInject(R.id.txt_free1)
	private TextView txt_free1;

	@ViewInject(R.id.txt_total_horse)
	private TextView txt_total_horse;

	@ViewInject(R.id.txt_total_quantity)
	private TextView txt_total_quantity;

	@ViewInject(R.id.txt_total_free1)
	private TextView txt_total_free1;

	@ViewInject(R.id.txt_ware_house)
	private TextView txt_ware_house;

	@ViewInject(R.id.txt_barcode)
	private TextView txt_barcode;

	@ViewInject(R.id.lbl_ware_house)
	private TextView lbl_ware_house;

	@ViewInject(R.id.view_ware_house)
	private View view_ware_house;

	public static FragmentWarehouseOrInvSum newInstance() {
		FragmentWarehouseOrInvSum fragment = new FragmentWarehouseOrInvSum();
		return fragment;
	}


	@Override
	public void appandChild(View view) {
		Bundle bundle = getArguments();
		String cmd = bundle.getString("COMMAND", "9001");
		if(cmd.equals("9002")){
			lbl_ware_house.setVisibility(View.GONE);
			txt_ware_house.setVisibility(View.GONE);
			view_ware_house.setVisibility(View.GONE);
		}
	}


	public void updateResponse(StockJsonRespose json) {
		txt_invname.setText(json.response.cInvName);
		txt_free1.setText(json.response.cFree1);
		txt_total_horse.setText(json.response.iTotalHorse + "");
		txt_total_quantity.setText(json.response.iTotalQuantity + "");
		txt_total_free1.setText(json.response.iTotalFree1 + "");
		txt_ware_house.setText(json.response.cWarehouse);

	}

	public void updateBarcode(String barcode) {
		txt_barcode.setText(barcode);
	}

}
